module.exports = class FileListPlugins {
    constructor(filename) {
        this.filename = filename;
    }
    apply(compiler) {
        compiler.hooks.emit.tap('FileListPlugins', compilation => {
            var fileList = [];
            for (const key in compilation.assets) {
                var content = `【${key}】
大小：${compilation.assets[key].size() / 1000}KB`;
                fileList.push(content);
            }
            var src = fileList.join('\n');
            compilation.assets[this.filename] = {
                source() {
                    return src;
                },
                size() {
                    return src.length; 
                },
            }
        })
    }
}